/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package no.ffi.tpm;

import java.util.logging.Level;
import java.util.logging.Logger;
import no.ffi.gismoidm.utils.IdentityStatement;
import no.ffi.tpm.crypto.CryptoOperations;
import no.ffi.tpm.crypto.CryptoOperationsFactory;
import no.ffi.tpm.utils.CaServiceTest;

/**
 *
 * @author Federico Mancinie <fma at ffi.no>
 */
public class TPMClient {
    private final String user;
    private final String pass;
    private final CryptoOperations crypto;
    private IdentityStatement idS;
    
    public TPMClient(String user, String pass){
        this.user=user;
        this.pass=pass;
        System.setProperty("JIDM.CONFIG","C:\\Users\\fma\\Dropbox\\TPMIdM\\gismoidm.properties");
        crypto=CryptoOperationsFactory.getInstance(CryptoOperationsFactory.TPM);
        
    }
    
    public void getIdS(String legacyKeyPass){
        TPMiSRequest iSReq=(TPMiSRequest) crypto.getISrequest();
        
        try {
            this.idS=(IdentityStatement) CaServiceTest.toPCA(iSReq, CaServiceTest.serviceURLIdP);
            System.out.println(this.idS.toString());
        } catch (Exception ex) {
            Logger.getLogger(TPMClient.class.getName()).log(Level.SEVERE, null, ex);
        }
        
    }
    
    
}
